import AutoImport from 'unplugin-auto-import/vite'
import Components from 'unplugin-vue-components/vite'
//ant-design-vue
import {AntDesignVueResolver} from "unplugin-vue-components/resolvers";

export default function createAutoImport() {
  return [
    AutoImport({
      imports: [
        'vue',
        'vue-router',
        'pinia'
      ],
      dirs: [//配置本地目录自动引入
        "./src/utils/",
        "./src/api/",
        "./src/store/modules/",
        "./src/router/",
        "./src/components/",
      ],
      resolvers: [AntDesignVueResolver()],
      dts: "types/auto-import.d.ts", // 生成 `auto-import.d.ts` 全局声明
    }),
    Components({
      dirs: ['./src/components/'],
      resolvers: [
        AntDesignVueResolver({importStyle: false, resolveIcons: true})
      ],
      dts: "types/components-auto-import.d.ts", // 生成 `auto-import.d.ts` 全局声明
    }),
  ]
}
